package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.dtos.SensitivePageReqDto;
import com.heima.model.common.pojos.wemedia.WmSensitive;
import com.heima.wemedia.service.SensitiveService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitive")
@Slf4j
public class SensitiveController {
    @Autowired
    private SensitiveService sensitiveService;
    @PostMapping("list")
    public ResponseResult list(@RequestBody SensitivePageReqDto dto){
        log.info("查询敏感词列表：{}",dto);
        return sensitiveService.pageQuery(dto);
    }
    @PostMapping("save")
    public ResponseResult save(@RequestBody WmSensitive wmSensitive){
        log.info("新增敏感词保存：{}",wmSensitive);
        return sensitiveService.saveSensitive(wmSensitive);
    }
    @PostMapping("update")
    public ResponseResult update(@RequestBody WmSensitive wmSensitive){
        log.info("敏感词修改：{}",wmSensitive);
        return sensitiveService.updateSensitive(wmSensitive);
    }
    @DeleteMapping("del/{id}")
    public ResponseResult delete(@PathVariable Integer id){
        log.info("敏感词删除：{}",id);
        return sensitiveService.deleteSensitive(id);
    }

}
